/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exercicio.lista1;

import java.util.Random;

/**
 *
 * @author afonso
 */
public class Questao2 {
    
    public static void main(String[] args) {
        int nExp =100000;
        int evento = 0;
        Random r = new Random(System.currentTimeMillis());
        for (int i = 0; i < nExp; i++) {
            int face1 = r.nextInt(6) + 1;
            int face2 = r.nextInt(6) + 1;
            int face3 = r.nextInt(6) + 1;
            int face4 = r.nextInt(6) + 1;
            int soma = face1 + face2 + face3 + face4;
            if (soma >= 15 && soma <= 20) {
                evento++;
            }
        }
        double p = (double) evento / nExp;
        System.out.println("Probabilidade: " + p);
    }
    
}
